package com.shujia.flink.transform;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;

public class Demo06Union {
    public static void main(String[] args) throws Exception {
        // union：将多个DS合并成一个DS

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        ArrayList<String> arr = new ArrayList<>();
        arr.add("java,scala,python");

        DataStream<String> arrDS01 = env.fromCollection(arr);
        DataStream<String> arrDS02 = env.fromCollection(arr);
        DataStream<String> unionDS = arrDS01.union(arrDS02);

        unionDS.print();

        env.execute();
    }
}
